/********************************************************/
/*	Author:		gong_libin			*/
/*	Date:		2017_11_01			*/
/*	File:		CmMysqlTest.cpp			*/
/********************************************************/

#include "CmPro.h"
#include "CmUtil.h"
#include "CmMysql.h"

int main(int argc, char* argv[])
{
	CCmMysql CMysql;
	MYSQL_ROW stRow;
	MYSQL_RES* pstRes = NULL;
	char szSql[CM_BUFFER] = "SELECT * FROM sunlake.tbl_ad_dsp_detail";

	if (CM_SUCCESS == CMysql.CmMysqlConnect((char*)"192.168.0.7", (char*)"3306", (char*)"root", (char*)"123456")) {
		if (NULL != (pstRes = (MYSQL_RES*)CMysql.CmMysqlSelect(szSql))) {
			while (NULL != (stRow = mysql_fetch_row(pstRes))) {
				CM_PRINT("%s, %s, %s, %s, %s\n", stRow[0], stRow[1], stRow[2], stRow[3], stRow[4]);
			}
			mysql_free_result(pstRes);
		}
		else {
		}
	}
	else {
		CM_ERROR("Failed to CmMysqlConnect\n");
	}

	return CM_SUCCESS;
}
